import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        redirect: "/login"
    },
    {
        path: '/login',
        component: () => import('../views/Login.vue'),
    },
    {
        path: '/register',
        component: () => import('../views/login/Register.vue'),
    },
    {
        path: '/home',
        name: 'Home',
        component: () => import('../views/Home.vue'),
        /*children:[
            {
              path: '/playinformation',
              name: 'playinformation',
              component:() => import('../views/home1/PlayerInformation.vue'),
              meta:{comp:"/playinformation",pathname:"玩家管理",name:"玩家信息"}
            },
            {
              path: '/newguide',
              name: 'newguide',
              component:() => import('../views/home1/NewGuide.vue'),
              meta:{comp:"/newguide",pathname:"玩家管理",name:"新手引导"}
            },
            {
              path: '/rolezr',
              name: 'rolezr',
              component:() => import('../views/home1/RoleZR.vue'),
              meta:{comp:"/rolezr",pathname:"角色管理",name:"角色整容"}
            },
            {
              path: '/recharge',
              name: 'recharge',
              component:() => import('../views/home1/Recharge.vue'),
              meta:{comp:"/recharge",pathname:"角色管理",name:"充值玩家"}
            },
            {
              path: '/hangup',
              name: 'hangup',
              component:() => import('../views/home1/HangUP.vue'),
              meta:{comp:"/hangup",pathname:"角色管理",name:"挂机关卡"}
            },
            {
              path: '/dwrecharge',
              name: 'dwrecharge',
              component:() => import('../views/home1/dwRecharge.vue'),
              meta:{comp:"/dwrecharge",pathname:"付费与货币",name:"档位充值"}
            },
            {
              path: '/racedrawtimes',
              name: 'racedrawtimes',
              component:() => import('../views/home1/Racedrawtimes.vue'),
              meta:{comp:"/racedrawtimes",pathname:"付费与货币",name:"种族抽"}
            },
            {
              path: '/retention',
              name: 'retention',
              component:() => import('../views/home1/Retention.vue'),
              meta:{comp:"/retention",pathname:"留存率",name:"留存率查询"}
            },
            {
              path: '/activationcode',
              name: 'activationcode',
              component:() => import('../views/home1/Activationcode.vue'),
              meta:{comp:"/activationcode",pathname:"激活码",name:"激活码查询"}
            },
            {
              path: '/rolegift',
              name: 'rolegift',
              component:() => import('../views/home1/Rolegift.vue'),
              meta:{comp:"/rolegift",pathname:"物品流水",name:"角色物品流水"}
            },
            {
              path: '/notice',
              name: 'notice',
              component:() => import('../views/home1/Notice.vue'),
              meta:{comp:"/notice",pathname:"公告/跑马灯",name:"公告"}
            },
            {
              path: '/pmd',
              name: 'pmd',
              component:() => import('../views/home1/Pmd.vue'),
              meta:{comp:"/pmd",pathname:"公告/跑马灯",name:"跑马灯"}
            },
            {
              path: '/mail',
              name: 'mail',
              component:() => import('../views/home1/Mail.vue'),
              meta:{comp:"/mail",pathname:"邮件管理",name:"邮件查询"}
            },
            {
              path: '/ban',
              name: 'ban',
              component:() => import('../views/home1/Ban.vue'),
              meta:{comp:"/ban",pathname:"封禁",name:"封禁查询"}
            },
        ]*/
        children: [
            {
                path: '/home',
                name: '管理系统主页',
                component: () => import('../views/home/Home.vue'),
                meta: {comp: "/home", pathname: "管理系统主页", name: "管理系统主页"}
            }, {
                path: '/user/normal',
                name: '普通用户管理',
                component: () => import('../views/user/Normal.vue'),
                meta: {comp: "/buyer", pathname: "普通用户管理", name: "普通用户管理"}
            }, {
                path: '/user/teacher',
                name: '教师信息管理',
                component: () => import('../views/user/Teacher.vue'),
                meta: {comp: "/seller", pathname: "教师信息管理", name: "教师信息管理"}
            }, {
                path: '/order/query',
                name: '订单查询',
                component: () => import('../views/order/Query.vue'),
                meta: {comp: "/order/query", pathname: "订单查询", name: "订单查询"}
            }, {
                path: '/category',
                name: '分类信息管理',
                component: () => import('../views/category/Query.vue'),
                meta: {comp: "/category", pathname: "分类信息管理", name: "分类信息管理"}
            }, {
                path: '/course/issue',
                name: '课程发布审批',
                component: () => import('../views/course/Issue.vue'),
                meta: {comp: "/course/issue", pathname: "课程发布审批", name: "课程发布审批"}
            },{
                path: '/course/examine',
                name: '课程考试管理',
                component: () => import('../views/course/Examine.vue'),
                meta: {comp: "/course/issue", pathname: "课程考试管理", name: "课程考试管理"}
            }, {
                path: '/info',
                name: '个人信息管理',
                component: () => import('../views/info/Info.vue'),
                meta: {comp: "/info", pathname: "个人信息管理", name: "个人信息管理"}
            }, {
                path: '/logout',
                name: '信息注销管理',
                component: () => import('../views/info/Logout.vue'),
                meta: {comp: "/logout", pathname: "信息注销管理", name: "信息注销管理"}
            }, {
                path: '/blank',
                name: '空白页',
                component: () => import('../views/blank/Blank.vue'),
                meta: {comp: "/blank", pathname: "空白页", name: "空白页"}
            }, {
                path: '/success',
                name: '购买成功',
                component: () => import('../views/blank/Success.vue'),
                meta: {comp: "/success", pathname: "购买成功", name: "购买成功"}
            }, {
                path: '/videoShow',
                name: '视频播放展示',
                component: () => import('../views/video/Show.vue'),
                meta: {comp: "/videoShow", pathname: "视频播放展示", name: "视频播放展示"}
            }, {
                path: '/buyerCar',
                name: '教学视频展示',
                component: () => import('../views/buyerCar/BuyerCar.vue'),
                meta: {comp: "/buyerCar", pathname: "教学视频展示", name: "教学视频展示"}
            }, {
                path: '/buyerCarDetails',
                name: '教学视频详情',
                component: () => import('../views/buyerCar/BuyerCarDetails.vue'),
                meta: {comp: "/buyerCarDetails", pathname: "教学视频详情", name: "教学视频详情"}
            }
        ]
    }
];

//设置全局变量
localStorage.setItem("globalUrl", "http://127.0.0.1:8761/oe/");
localStorage.setItem("uploadFileUrl","http://127.0.0.1:8761/oe/uploadFile");

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})
const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(to) {
    return VueRouterPush.call(this, to).catch(err => err)
}
export default router
